package cn.kgc.lqy.demo.controller;

import cn.kgc.lqy.demo.pojo.Student;
import cn.kgc.lqy.demo.services.StudentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/user")
public class StudentController {

    @Resource
    private StudentService studentService;

    @RequestMapping("/showList")
    protected List<Student> findAll(){
        return  studentService.findAll();
    }

    @RequestMapping("/add")
    protected void addStu(@RequestBody Student student){
        studentService.addStu(student);
    }

    @RequestMapping("/change")
    protected void modifyStu(@RequestBody Student student){
        studentService.modifyStu(student);
    }

    @RequestMapping("/delete")
    protected void deleteStu(Integer sid){
        studentService.deleteStu(sid);
    }
}
